<?php session_start(); ?>
<?php
 if(!$_SESSION['uname']){
  echo "你没有权限访问此页面!";
  return false;
}
?>
<?php include ("../inc/db_config.inc"); ?>
<?php
$post_pubid = 1;
if(isset($_REQUEST['format'])&&$_REQUEST['format']!=""){
    $p_format=$_REQUEST['format'];
}
if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != "") {
    $delarray = implode(",", $_REQUEST['pid']);
    $p_del = mysql_query("delete from info where pubid=$post_pubid and id in ($delarray)");
    if (mysql_affected_rows() > 0) {
        $ref = $_SERVER['HTTP_REFERER'];
        if($p_format=="json"){
            echo '{"Status":1,"ReturnCode":"删除成功"}';
            return false;
        }
        echo "删除成功!页面会在1秒钟后自动返回.<script type='text/javascript'>setTimeout(function(){window.location.href='$ref'},2000)</script>";
    } else {
        if($p_format=="json"){
            echo '{"Status":0,"ReturnCode":"删除失败"}';
            return false;
        }
        echo "删除失败!<a href='javascript:history.back()'>返回</a>";
    }

} else {
    if($p_format=="json"){
            echo '{"Status":0,"ReturnCode":"请先选择要删除的文章"}';
            return false;
        }
    echo "该文章不存在<a href='javascript:history.back()'>返回</a>";
    return false;
}




?>